//两个数组的坐标对应，后期可以直接连数据库 读取数据
var xinm = ["远大幸福家园1","远大幸福家园","远大幸福家园","远大幸福家园","远大幸福家园5","远大幸福家园6" ];

var phone = ["4栋C2061","4栋C2062","4栋C2063","4栋C2064","4栋C2065","4栋C2066"];




var nametxt = $('.name');
var phonetxt = $('.phone');
var pcount = xinm.length-1;//参加人数
var runing = true;
var td = 6;//，共6个名额
var num = 0;
var t;






//开始停止
function start() {
	
	if (runing) {
		runing = false;
		$('#btntxt').addClass('stop');
		$('#btntxt').html('停止摇号');
		startNum();
		setTimeout(function(){
			stop();			
		},3000)
		
		
	} else {
		runing = true;
		// $('#btntxt').removeClass('stop').addClass('start');
		$('#btntxt').html('开始摇号');
		stop();
		
	}
}
//循环参加名单
function startNum() {
	num = Math.floor(Math.random() * pcount);
	console.log(num)
	nametxt.html(xinm[num]);
	phonetxt.html(phone[num]);
	t = setTimeout(startNum, 0);
}
//停止跳动
function stop() {
	pcount = xinm.length-1;
	clearInterval(t);
	t = 0;
}





//两个数组的坐标对应，后期可以直接连数据库 读取数据
var xinm2 = ["远大幸福家园4栋2单元301号1","远大幸福家园4栋2单元301号2","远大幸福家园4栋2单元301号3","远大幸福家园4栋2单元301号4","远大幸福家园4栋2单元301号5","远大幸福家园4栋2单元301号6" ];

var phone2 = ["三室两厅两卫1","三室两厅两卫2","三室两厅两卫3","4三室两厅两卫4","4三室两厅两卫65","4栋C2066"];









var nametxt2 = $('.name2');
var phonetxt2 = $('.phone2');
var pcount2 = xinm.length-1;//参加人数
var runing2 = true;
var td2 = 6;//，共6个名额
var num2= 0;
var t2;


//开始停止
function start2() {
	if (runing2) {
		runing2 = false;
		$('#btntxt2').addClass('stop');
		$('#btntxt2').html('停止摇号');
		
		startNum2();
		setTimeout(function(){
			stop2();			
		},3000)
		
		
	} else {
		runing2 = true;
		// $('#btntxt').removeClass('stop').addClass('start');
		$('#btntxt2').html('开始摇号');
		stop2();
		
	}
}
//循环参加名单
function startNum2() {
	num2 = Math.floor(Math.random() * pcount2);
	nametxt2.html(xinm2[num2]);
	phonetxt2.html(phone2[num2]);
	t2 = setTimeout(startNum2, 0);
}
//停止跳动
function stop2() {
	pcount2 = xinm2.length-1;
	clearInterval(t2);
	t2 = 0;
}